#include <stdio.h>
/*
* I_1.c
*
*  Created on: April, 19, 2009
*      Author: yimingliu@fudan.edu.cn
*/

void funI_1_fun(char *s, char *p)
{
	int i,j,n,x,t;
	n=0;
	for(i=0;s[i]!='\0';i++) n++;
	for(i=1;i<n-2;i=i+2){
		t=i;
		for(j= i+2;j<n;j=j+2)
			if(s[t]>s[j]) t=j;
		if(t!=i)
		{
			x=s[i];s[i]=s[t];s[t]=x;
		}
	}
	for(i=1,j=0;i<n;i=i+2,j++)
		p[j]=s[i];
	p[j]= '\0';
}

void funI_1()
{
	char s[80]="baawrskjghzlicda",p[50];
	printf("\nThe orginal string is: %s\n",s);
	funI_1_fun(s,p);
	printf("\nThe result is: %s\n",p);
}